home *** CD-ROM | disk | FTP | other *** search
- PROGRAM ficycle;
- (* *)
- (* 1.0 11/89 ZZ Zimmerman *)
-
- {$U+}
-
- USES Memtypes, Quickdraw, OSIntf, ToolIntf, PackIntf, MacPrint;
-
- VAR
- targetVolume: INTEGER;
- targetFileName: Str255;
- theIOParams: ParamBlockRec;
- theError: OSErr;
-
- PROCEDURE Debugger; INLINE $A9FF;
-
- (* Use Standard File to get and open a file to be printed. *)
- FUNCTION GetVolume(VAR vRefNum: INTEGER): BOOLEAN;
- CONST
- numTypes = 1;
- VAR
- theReply: SFReply;
- theTypes: SFTypeList;
- theTopLeft: Point;
- theError: OSErr;
- BEGIN
- SetPt(theTopLeft, 100, 100);
- SFGetFile(theTopLeft, '', NIL, 0, theTypes, NIL, theReply);
- vRefNum := theReply.vRefNum;
- GetVolume := theReply.good;
- END;
-
-
- BEGIN
- (* InitGraf(@thePort);
- InitFonts;
- FlushEvents(everyEvent, 0);
- InitWindows;
- InitMenus; *)
- TEInit;
- InitDialogs(NIL);
- InitCursor;
-
- (* Start by calling SFGetFile to allow the user to choose a folder. *)
- IF GetVolume(targetVolume) THEN BEGIN
- (* If we got one, now we need to call SetVol to select the *)
- (* folder. Although the name SetVol implies that only a volume *)
- (* can be set, SetVol is smart enough to use a folder as a volume.*)
- theError := SetVol(NIL, targetVolume);
-
- (* Now we want to loop through all of the files in this folder. *)
- (* We do this by using the extra cool FDirIndex feature of the *)
- (* File Manager's parameter block calls. *)
- theIOParams.ioFDirIndex := 1;
-
- (* When we run out of files, GetFInfo will return an error. *)
- (* While it returns noErr, we'll keep looping and writing out the *)
- (* name of the file we found. *)
- WHILE theError = noErr DO BEGIN
-
- WITH theIOParams DO BEGIN
- (* The file name (to be filled in by GetFInfo. *)
- ioNamePtr := @targetFileName;
-
- (* The volume reference number that we got from SFGetFile. *)
- ioVRefNum := targetVolume;
-
- (* Version number should always be zero. *)
- ioVersNum := 0;
- END;
-
- (* Okay, now try to get information about this file. *)
- theError := PBGetFInfo(@theIOParams, FALSE);
-
- (* If we got the info, write out the file's name. *)
- IF theError = noErr THEN WRITELN(targetFileName);
-
- (* Increment to the next file in the folder (if any). *)
- theIOParams.ioFDirIndex := theIOParams.ioFDirIndex + 1;
- END;
- END;
-
- (* Give the user a chance to see what's going on. *)
- WHILE NOT Button DO ;
- END.
-